#pragma once

#include "common.h"
//#include<pthread.h>

//using namespace log_ns;
class ThreadCache
{
public:
    void *Allocate(size_t size);
   
    void ListTooLong(Freelist& freelist,size_t size);
    void* FetchFromCentralCache(size_t index, size_t size);
    void DeAllocate(void *obj,size_t size);

private:
    Freelist _freelists[BucketNums];
};

// TLS thread local storage
//static __thread ThreadCache* pThreadCache;
static _declspec(thread) ThreadCache* pThreadCache = nullptr;
static FixSizedMemoryPool<ThreadCache> _ThreadCachePool;

